import {IsUseSysTitle} from "./const";
import {preloadPath} from "./staticPath";
import {BrowserWindowConstructorOptions} from "electron";

const preload = preloadPath;

export const mainWindowConfig: BrowserWindowConstructorOptions = {
	height: 800,
	useContentSize: true,
	width: 1700,
	minWidth: 1366,
	show: false,
	frame: IsUseSysTitle,
	webPreferences: {
		preload,
		contextIsolation: true, //内容上下文隔离
		nodeIntegration: false, //是否允许禁用渲染器沙盒，禁用则窗口可使用Node.js模块的系统API
		webSecurity: true, //开启后将出现域名cors限制;内置服务器的mock请求要相应地调整express配置，在server/server.ts中配置跨域
		// 如果是开发模式可以使用devTools
		devTools: process.env.NODE_ENV === "development",
		// 在macos中启用橡皮动画
		scrollBounce: process.platform === "darwin",
	},
};

export const otherWindowConfig: BrowserWindowConstructorOptions = {
	height: 595,
	useContentSize: true,
	width: 1140,
	autoHideMenuBar: true,
	minWidth: 842,
	frame: IsUseSysTitle,
	show: false,
	webPreferences: {
		preload,
		contextIsolation: true,
		nodeIntegration: false,
		webSecurity: true,
		// 如果是开发模式可以使用devTools
		devTools: process.env.NODE_ENV === "development",
		// 在macos中启用橡皮动画
		scrollBounce: process.platform === "darwin",
	},
};
